<template>
  <div class="divtop">
    <van-icon class="icon1" name="setting-o" @click="setClick" />
    <van-icon
      class="icon2"
      name="share"
      style="margin-right: 10px"
      @click="showShare = true"
    />
    <van-share-sheet
      v-model="showShare"
      title="立即分享给好友"
      :options="options"
      @select="onSelect"
    />
    <van-icon class="icon2" name="chat-o" />
    <van-icon class="icon2" name="qr" />
  </div>
</template>
<script>
import Vue from "vue";
import { ShareSheet } from "vant";
import { Toast } from "vant";

Vue.use(ShareSheet);
export default {
  data: function () {
    return {
      showShare: false,
      options: [
        { name: "QQ", icon: "qq" },
        { name: "微信", icon: "wechat" },
        { name: "微博", icon: "weibo" },
        { name: "复制链接", icon: "link" },
        { name: "分享海报", icon: "poster" },
        { name: "二维码", icon: "qrcode" },
      ],
    };
  },
  methods: {
    onSelect(option) {
      Toast(option.name);
      this.showShare = false;
    },
    setClick() {
      this.$router.push("/setup");
    },
  },
};
</script>

<style scoped>
.divtop {
  width: 100%;
  height: 46px;
  color: white;
  z-index: 10;
}
.icon1 {
  color: white;
  font-size: 24px;
  width: 50px;
  height: 46px;
  line-height: 46px;
  text-align: center;
}

.icon2 {
  color: white;
  font-size: 24px;
  width: 34px;
  height: 46px;
  line-height: 46px;
  text-align: center;
  float: right;
}
</style>